package com.boss.common.enums;


/**
 * <br>Title:工作作流适配操作日志枚举类
 * <br>Description:工作作流适配Action枚举类，在查询工作流日志使用
 * <br>Author:朱孝恒(zhuxiaoheng@bosssoft.com.cn)
 * <br>Date:2019-6-21
 */
public enum  ActionLogTypeEnum {

    /**
     * 完成任务
     */
    COMPLETE_TASK {
        @Override
        public String getAction() {
            return "COMPLETE_TASK";
        }

        @Override
        public String getActionName() {
            return "审核";
        }

    },

    /**
     * 退回任务
     */
    BACK_TASK {
        @Override
        public String getAction() {
            return "BACK_TASK";
        }

        @Override
        public String getActionName() {
            return "退回";
        }
    },

    /**
     * 取消任务的退回
     */
    CANCEL_BACK {
        @Override
        public String getAction() {
            return "CANCEL_BACK";
        }

        @Override
        public String getActionName() {
            return "撤销退回";
        }
    },

    /**
     * 回收任务
     */
    WITHDRAW_TASK {
        @Override
        public String getAction() {
            return "WITHDRAW_TASK";
        }

        @Override
        public String getActionName() {
            return "撤销";
        }
    },

    /**
     * 任务加签
     */
    INSERT_TASK {
        @Override
        public String getAction() {
            return "INSERT_TASK";
        }

        @Override
        public String getActionName() {
            return "加签";
        }
    },

    /**
     * 协办重做
     */
    REDO {
        @Override
        public String getAction() {
            return "REDO";
        }

        @Override
        public String getActionName() {
            return "协办重做";
        }
    },

    /**
     * 拒绝委托
     */
    CONSIGN_REJECT {
        @Override
        public String getAction() {
            return "CONSIGN_REJECT";
        }

        @Override
        public String getActionName() {
            return "拒绝委托";
        }
    },

    /**
     * 启动流程
     */
    START_PROCESS {
        @Override
        public String getAction() {
            return "START_PROCESS";
        }

        @Override
        public String getActionName() {
            return "录入";
        }
    },

    /**
     * 撤销流程
     */
    REVOKE_PROCESS {
        @Override
        public String getAction() {
            return "REVOKE_PROCESS";
        }

        @Override
        public String getActionName() {
            return "撤销";
        }
    },

    /**
     * 恢复撤销流程
     */
    RECOVERY_PROCESS {
        @Override
        public String getAction() {
            return "RECOVERY_PROCESS";
        }

        @Override
        public String getActionName() {
            return "恢复撤销";
        }
    },

    /**
     * 终止流程
     */
    TERMINATE_PROCESS {
        @Override
        public String getAction() {
            return "TERMINATE_PROCESS";
        }

        @Override
        public String getActionName() {
            return "终止流程";
        }
    },

    /**
     * 删除任务
     */
    DELETE_TASK {
        @Override
        public String getAction() {
            return "DELETE_TASK";
        }

        @Override
        public String getActionName() {
            return "删除";
        }
    },

    /**
     * 删除流程实例
     */
    DELETE_PROCESS {
        @Override
        public String getAction() {
            return "DELETE_PROCESS";
        }

        @Override
        public String getActionName() {
            return "删除流程";
        }
    },
    EDIT {
        @Override
        public String getAction() {
            return "AddComment";
        }

        @Override
        public String getActionName() {
            return "修改";
        }
    },
    NULL {
        @Override
        public String getAction() {
            return null;
        }

        @Override
        public String getActionName() {
            return "待操作";
        }
    };
    /**
     * 获取操作Action英文名称
     * <br>Description:获取操作英文名称
     * <br>Author:朱孝恒(zhuxiaoheng@bosssoft.com.cn)
     * <br>Date:2019-7-11
     * @return String 操作英文名称
     */
    public abstract String getAction();
    /**
     * 获取操作中文名称
     * <br>Description:获取操作中文名称
     * <br>Author:朱孝恒(zhuxiaoheng@bosssoft.com.cn)
     * <br>Date:2019-7-11
     * @return String 操作中文名称
     */
    public abstract String getActionName();
    /**
     * 根据Action获取枚举对象
     * <br>Description:根据Action获取枚举对象
     * <br>Author:朱孝恒(zhuxiaoheng@bosssoft.com.cn)
     * <br>Date:2019-7-11
     * @param action 操作日志的action
     * @return ActionLogTypeEnum 操作日志枚举类
     */
    public static ActionLogTypeEnum toEnum(String action) {
        if (action == null) {
            return ActionLogTypeEnum.NULL;
        } else if (ActionLogTypeEnum.COMPLETE_TASK.getAction().equals(action)) {
            return ActionLogTypeEnum.COMPLETE_TASK;
        } else if (ActionLogTypeEnum.BACK_TASK.getAction().equals(action)) {
            return ActionLogTypeEnum.BACK_TASK;
        } else if (ActionLogTypeEnum.CANCEL_BACK.getAction().equals(action)) {
            return ActionLogTypeEnum.CANCEL_BACK;
        } else if (ActionLogTypeEnum.WITHDRAW_TASK.getAction().equals(action)) {
            return ActionLogTypeEnum.WITHDRAW_TASK;
        } else if (ActionLogTypeEnum.INSERT_TASK.getAction().equals(action)) {
            return ActionLogTypeEnum.INSERT_TASK;
        } else if (ActionLogTypeEnum.REDO.getAction().equals(action)) {
            return ActionLogTypeEnum.REDO;
        } else if (ActionLogTypeEnum.CONSIGN_REJECT.getAction().equals(action)) {
            return ActionLogTypeEnum.CONSIGN_REJECT;
        } else if (ActionLogTypeEnum.START_PROCESS.getAction().equals(action)) {
            return ActionLogTypeEnum.START_PROCESS;
        } else if (ActionLogTypeEnum.REVOKE_PROCESS.getAction().equals(action)) {
            return ActionLogTypeEnum.REVOKE_PROCESS;
        } else if (ActionLogTypeEnum.RECOVERY_PROCESS.getAction().equals(action)) {
            return ActionLogTypeEnum.RECOVERY_PROCESS;
        } else if (ActionLogTypeEnum.TERMINATE_PROCESS.getAction().equals(action)) {
            return ActionLogTypeEnum.TERMINATE_PROCESS;
        } else if (ActionLogTypeEnum.DELETE_TASK.getAction().equals(action)) {
            return ActionLogTypeEnum.DELETE_TASK;
        } else if (ActionLogTypeEnum.DELETE_PROCESS.getAction().equals(action)) {
            return ActionLogTypeEnum.DELETE_PROCESS;
        } else if (ActionLogTypeEnum.EDIT.getAction().equals(action)) {
            return ActionLogTypeEnum.EDIT;
        }
        return ActionLogTypeEnum.NULL;
    }
}
